import { get_time_normal_to_format } from '../../../../global/Func/get_cur_format_time';
import { prop_cur_req_time } from '../Classes/cla_req_cur_headers_info';

type typ_mount_file_info = {
  id: string;
  ext: string;
};

type typ_mount_file_info_time = typ_mount_file_info & {
  [prop_cur_req_time]: string;
};

/**
 * @param {{ id: string, ext: string}} cur_info
 *
 * ${cur_info.id}.${cur_info.ext}
 */
export function get_file_name_cur_info(cur_info: typ_mount_file_info) {
  return `${cur_info.id}.${cur_info.ext}`;
}

/**
 * @param {{ id: string, ext: string, req_time: string}} cur_info
 *
 * ${cur_info.id}_${duoto_time}.${cur_info.ext}
 */
export function get_file_name_cur_info_time(
  cur_info: typ_mount_file_info_time
) {
  return `${cur_info.id}_${get_time_normal_to_format(
    cur_info[prop_cur_req_time]
  )}.${cur_info.ext}`;
}
